// 适配,等比例缩放

(function (w, d, undefined) {
  
  var $root          = d.documentElement,
      dpr            = w.devicePixelRatio || 1,
      body_font_size = (12 * dpr) + 'px',
      rem            = d.clientWidth  / 10

  if (d.body) {
    d.body.style.fontSize = body_font_size
  } else {
    document.addEventListener('DOMContentLoaded', function() {
      d.body.style.fontSize = body_font_size
    })
  }
  
  setRootRem()

  function setRootRem() {
    $root.style.fontSize = $root.clientWidth  / 10 + 'px'
  }
  
  window.addEventListener('resize', setRootRem)

})(window, document)